package com.csdj.t309.geamtest.controller;


import com.csdj.t309.geamtest.common.CacheConstant;
import com.csdj.t309.geamtest.common.WebResult;
import com.csdj.t309.geamtest.common.WebResultMsgCode;
import com.csdj.t309.geamtest.entity.Jifen;
import com.csdj.t309.geamtest.service.IJifenService;
import com.csdj.t309.geamtest.service.IUserService;
import com.csdj.t309.geamtest.service.RedisService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 田港
 * @since 2022-01-12
 */
@RestController
@RequestMapping("/jifen")
public class JifenController {
    @Resource
    private IJifenService iJifenService;
    @Resource
    private RedisService redisService;

    @PostMapping("/selJiFen")
    public WebResult selJiFen(HttpServletRequest request){
        List<Jifen> list = iJifenService.selJiFen(redisService.getObject(CacheConstant.HEADER_UID+request.getHeader(CacheConstant.HEADER_UID)));
        return new WebResult(WebResultMsgCode.SUCCESS).putData("list",list);
    }
}
